#!usr/bin/env python  
# -*- coding:utf-8 -*-
""" 
@author:robot
@file: titile01篮球比赛.py 
@version:
@time: 2023/05/27
https://dream.blog.csdn.net/article/details/129018305
"""


def main():
    t = int(input().strip())
    scores = [int(x) for x in input().split()]
    scores = solve_method(scores)
    print(scores)


def solve_method(scores):
    sum_ = sum(scores)
    my_list = list(scores)
    for i in range(len(scores), 0, -1):
        if sum_ % i == 0:
            if if_exist(my_list, sum_ // i, sum_ // i):
                return sum_ // i
    return sum_


def if_exist(root_list, num, org_num):
    if len(root_list) == 0 and num == org_num:
        return True
    flag = False
    for i in range(len(root_list)):
        sub_list = root_list[:i] + root_list[i + 1:]
        if root_list[i] == num:
            flag = flag or if_exist(sub_list, org_num, org_num)
        elif root_list[i] < num:
            flag = flag or if_exist(sub_list, num - root_list[i], org_num)
    return flag


main()
